<?php


// 获取单条
$info = $this->FactoryInfoDao->get($id);
$info = $this->FactoryInfoDao->getWhere(["id" => $id, "status" => 1]);

// 获取数量
$count = $this->FactoryInfoDao->getWhereCount(["status" => 1]); // 数量

// 获取单表列表
$list = $this->FactoryInfoDao->getWhereList(["status" => 1]); // 所有
$list = $this->FactoryInfoDao->getWhereList(["status" => 1], ["createTime" => "desc", "id" => "asc"]); // 排序
$list = $this->FactoryInfoDao->getWhereList(["status" => 1], ["createTime" => "desc", "id" => "asc"], [0, 20]); // 排序+分页

// 增改会自动填写createTime和updateTime

// 添加
$id = $this->FactoryInfoDao->insert($data); // 单条插入, 返回主键
$this->FactoryInfoDao->insert([$data1, $data2, $data3]); // 批量插入
// ->add 同理


// 主键更新, 条件更新, 返回影响条数
$count = $this->FactoryInfoDao->update($id, $update);
$count = $this->FactoryInfoDao->update(["id" => $id], $update);
$count = $this->FactoryInfoDao->updateWhere(["status" => 0], ["status" => 1]);
// ->set, ->setWhere 同理

// 删除, 条件删除, 返回影响条数
$count = $this->FactoryInfoDao->del($id);
$count = $this->FactoryInfoDao->delWhere(["countryId" => 1]);
// 非软删除(真实删除)
$count = $this->FactoryInfoDao->del($id, false);
$count = $this->FactoryInfoDao->delWhere($id, false);


// 通用联表列表
$params = [
	"countryId"       => 1,
	"status"          => 1,
	"createTimeRange" => ["开始时间", "结束时间"],
];
$count = $this->FactoryInfoDao->getCount($params);
$list = $this->FactoryInfoDao->getList($params, 1, 20);